home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr28 / mxmnu239.zip / INST.MNU < prev    next >
Text File  |  1993-03-22  |  13KB  |  438 lines

  1. Comment
  2. =========================================================
  3.  
  4. MarxMenu installation Menu:
  5.  
  6. Copyright 1989-1992 by Marc Perkel * All rights reserved.
  7.  
  8. This is an example of how MarxMenu can be used as a job control
  9. language. There is quite an education in MarxMenu tricks here. If
  10. you want to write a similar program, this menu is worth studying.
  11.  
  12. =========================================================
  13. EndComment
  14.  
  15. Var
  16.   EchoSt
  17.   FileLine
  18.   FileLinePtr
  19.   ProgName
  20.   BatExit
  21.   EchoTail
  22.   ConfigSysPath
  23.   ConfigSysLines
  24.   WorkStr
  25.   DosVerNumber
  26.  
  27. Const
  28.   PauseTime = 100
  29.  
  30. DelFile 'MENUS.EXE'
  31.  
  32. InitialDisplay
  33.  
  34. Shadow Off
  35. DrawBox 25 11 31 7
  36.  
  37. DosVerNumber = DosVersion * 100 + MinorDosVersion
  38.  
  39. ;MXECHO is a debugging environment variable. Use SET MXMENU=OFF for
  40. ;normal use. SET MXECHO=ON to watch the MARX.BAT run.
  41.  
  42. If ReadEnv('MXECHO') > ''
  43.    EchoTail = '%MXECHO%'
  44. Else
  45.    EchoTail = 'OFF'
  46. EndIf
  47.  
  48. if DosVerNumber >= 330
  49.    EchoSt = '@ECHO ' + EchoTail
  50. else
  51.    EchoSt = 'ECHO ' + EchoTail
  52. endif
  53.  
  54.  
  55. ProgName = CleanFileName(Path + '\MARXMENU.EXE')
  56.  
  57. Write ' Creating MARX.BAT ... '
  58.  
  59. ;----- BatExit is a 0k bat file used to exit batch files
  60.  
  61. FileAssign (BatExit,'BATEXIT.BAT')
  62. FileCreate BatExit
  63. FileClose  BatExit
  64.  
  65. ;----- Here we create the MARX.BAT file.
  66.  
  67. ClearLineBuffer
  68.  
  69. AddLine (EchoSt)
  70. AddLine (ProgName + ' %1 ')
  71. AddLine ('%MXCMD%')
  72. AddLine (CleanFileName(Path + '\MARX.BAT') + ' %1')
  73. AddLine ('')
  74. AddLine ('Goto ERROR1')
  75. AddLine ('')
  76. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  77. AddLine ('')
  78. AddLine ('MarxMenu * CopyRight 1989-92 by Marc Perkel')
  79. AddLine ('')
  80. AddLine ('If you are having trouble getting MarxMenu to work,')
  81. AddLine ('the first line of this file can be changed to ECHO ON.')
  82. AddLine ('')
  83. AddLine ('MarxMenu controls this batch file by writing to the environment')
  84. AddLine ('variable MXCMD.')
  85. AddLine ('')
  86. AddLine ('MXSTOP.BAT is executed to exit this batch file.')
  87. AddLine ('')
  88. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  89. AddLine ('')
  90. AddLine ('         MARX.BAT')
  91. AddLine ('         --------   +--MarxMenu Creates--+')
  92. AddLine ('  +----> @ECHO OFF  |                    |')
  93. AddLine ('  |      MARXMENU.EXE %1                 |')
  94. AddLine ('  |      %MXCMD% >--+                    +-> $MX00000.BAT')
  95. AddLine ('  | +--> MARX %1 +  |                        ------------')
  96. AddLine ('  | |            |  +----------------------> CD\WORDSTAR')
  97. AddLine ('  +-|------<-----+                           WS --+')
  98. AddLine ('    |                                             |')
  99. AddLine ('    +-------------------------------------------<-+')
  100. AddLine ('')
  101. AddLine ('Note: MarxMenu sets MXCMD = CALL $MX00000.BAT')
  102. AddLine ('')
  103. AddLine ('By Default, MarxMenu creates the temporary batch file in the same')
  104. AddLine ('directory as MARXMENU.EXE. If a second parameter is specified, and')
  105. AddLine ('the second parameter is a directory, then MarxMenu will create the')
  106. AddLine ('batch file there. If the second paramerer is a file name, then MarxMenu')
  107. AddLine ('will use it for the temporary file.')
  108. AddLine ('')
  109. AddLine ('If you set and environment variable TEMP to the name of a directory,')
  110. AddLine ("MarxMenu will use this directory for it's temporary batch files.")
  111. AddLine ('')
  112. AddLine ('Example SET TEMP=C:\TEMPFILE')
  113. AddLine ('')
  114. AddLine ('The MARX.BAT file must be path accessable or you will get a')
  115. AddLine ('"Bad Command or FileName" error. MARXMENU.EXE must also be path')
  116. AddLine ('accessable. The directory where MarxMenu creates temporary batch')
  117. AddLine ('files does not need to be path accessable.')
  118. AddLine ('')
  119. AddLine ('*-=-=-=-=-=-=-=-=-=-=[ Error Trapping Section ]-=-=-=-=-=-=-=-=-*')
  120. AddLine ('')
  121. AddLine ('If you get here it is probably because you moved the MARX.BAT file')
  122. AddLine ("from the directory you installed it to a new directory and didn't")
  123. AddLine ('change the path to MARXMENU.EXE and MARX.BAT in lines 2 and 4 of')
  124. AddLine ('this batch file.')
  125. AddLine ('')
  126. AddLine (':ERROR1')
  127. AddLine ('CLS')
  128. AddLine ('Echo  * * * * * * Warning * * * * * * *')
  129. AddLine ('Echo.')
  130. AddLine ('Echo  Line 4 of this batch file does not point to the directory')
  131. AddLine ('Echo  where MARX.BAT is located. Change to the directory where')
  132. AddLine ('Echo  the MARXMENU files are located and type MARXMENU INST to')
  133. AddLine ('Echo  re-create the MARX.BAT file for that directory.')
  134. AddLine ('')
  135. AddLine ('Goto ENDBAT')
  136. AddLine ('')
  137. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  138. AddLine ('')
  139. AddLine ('This exit point is used if MXSTOP.BAT can not be found. It is')
  140. AddLine ('usually caused by moving the MarxMenu files from one directory')
  141. AddLine ('to another and not copying all the BAT files. MarxMenu sets the')
  142. AddLine ('environment variable MXCMD to GOTO E in order to get here.')
  143. AddLine ('')
  144. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  145. AddLine ('')
  146. AddLine (':E')
  147. AddLine ('CLS')
  148. AddLine ('Echo  * * * * * * Warning * * * * * * *')
  149. AddLine ('Echo.')
  150. AddLine ('Echo  The file MXSTOP.BAT, DROPTO.BAT, and BATEXIT.BAT should be in')
  151. AddLine ('Echo  the same directory as the MARX.BAT file. Run MARXMENU INST in')
  152. AddLine ('Echo  the directory where you want MARX.BAT to reside.')
  153. AddLine (':ENDBAT')
  154.  
  155.  
  156. WriteTextFile 'MARX.BAT' FileLine
  157.  
  158. ClearLineBuffer
  159.  
  160. ;----- Here we create the DROPTO.BAT file.
  161.  
  162. Writeln
  163. Write ' Creating DROPTO.BAT ... '
  164.  
  165. AddLine ('DEL %1')
  166. AddLine ('SET KSV=')
  167. AddLine ('SET MXCMD=')
  168. AddLine ('%2 %3 %4 %5 %6 %7 %8 %9')
  169. AddLine ('BATEXIT')
  170. AddLine ('')
  171. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  172. AddLine ('')
  173. AddLine ('DropTo is used when you want to eliminate the temporary batch')
  174. AddLine ('file created by MarxMenu. This is useful if you shell to DOS')
  175. AddLine ('and then run MarxMenu from the dos shell. It avoids the')
  176. AddLine ('"Missing Batch File" error.')
  177. AddLine ('')
  178. AddLine ('DropTo is run from within the temporary batch file you want')
  179. AddLine ('to eliminate.')
  180. AddLine ('')
  181. AddLine ('Usage: DROPTO %0 <command line>')
  182. AddLine ('')
  183. AddLine ("Here's how it works:")
  184. AddLine ('')
  185. AddLine ('     $MX00000.BAT <------deletes this file--------+')
  186. AddLine ('     ------------                                 |')
  187. AddLine ('     DROPTO %0 COMMAND.COM ------------> DEL %1 >-+')
  188. AddLine ('                                         SET KSV=')
  189. AddLine ('                                         SET MXCMD=')
  190. AddLine ('              %2 executes command.com--> %2 %3 %4 %5 %6 %7 %8 %9')
  191. AddLine ('')
  192. AddLine ('*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*')
  193.  
  194. WriteTextFile 'DROPTO.BAT' FileLine
  195.  
  196. ClearLineBuffer
  197.  
  198. ;----- Here we create the MXSTOP.BAT file.
  199.  
  200. Writeln
  201. Write ' Creating MXSTOP.BAT ... '
  202.  
  203. AddLine ('SET MXCMD=')
  204. AddLine ('SET KSV=')
  205. AddLine ('REM From here, you control the menu exit process!')
  206.  
  207. WriteTextFile 'MXSTOP.BAT' FileLine
  208.  
  209. ClearLineBuffer
  210.  
  211. ;----- Here we create the GOFILE.BAT file.
  212.  
  213. Writeln
  214. Write ' Creating GOFILE.BAT ... '
  215.  
  216. AddLine (EchoSt)
  217. AddLine ('MARXMENU GOFILE %1')
  218. AddLine ('REM This batch file is used only with the GOFILE menu.')
  219.  
  220. WriteTextFile 'GOFILE.BAT' FileLine
  221.  
  222. ClearLineBuffer
  223.  
  224. ;----- Here we create the \LOGIN\OFF.BAT file.
  225.  
  226. if ExistDir '\LOGIN' and NetworkVersion
  227.    if not ExistFile '\LOGIN\OFF.BAT'
  228.  
  229.       Writeln
  230.       Write ' Creating OFF.BAT ... '
  231.  
  232.       AddLine ('ECHO ON')
  233.       AddLine ('')
  234.       AddLine ('REM This batch file is used to log off the network.')
  235.       AddLine ('REM Add the commands you want to execute when logoff occurs here.')
  236.       AddLine ('')
  237.       AddLine ('LOGOUT')
  238.  
  239.       WriteTextFile '\LOGIN\OFF.BAT' FileLine
  240.  
  241.       ClearLineBuffer
  242.    endif
  243. endif
  244.  
  245. Wait PauseTime
  246. EraseTopWindow
  247.  
  248. CheckEnvSize
  249.  
  250. EraseTopWindow
  251. BoxBorderColor Yellow Mag
  252. BoxInsideColor White Mag
  253. DrawBox 18 10 44 7
  254. BoxBorderColor LGreen Blue
  255. BoxInsideColor Yellow Blue
  256. DrawBox 23 12 34 3
  257. WriteCenter 'MarxMenu Installed!'
  258. Wait PauseTime * 2
  259. EraseTopWindow
  260. EraseTopWindow
  261.  
  262. BoxBorderColor LCyan Blue
  263. BoxInsideColor White Blue
  264. DrawBox 14 9 52 11
  265. WriteCenter '* Warning! *'
  266. Writeln
  267. Writeln
  268. Writeln '  One common mistake that users make is running'
  269. Writeln '  MARXMENU <menu>. You are supposed to run menus'
  270. Writeln '  by typing MARX <menu> which uses the MARX.BAT'
  271. Writeln '  file. Also, besides reading the manual, please'
  272. Writeln '  read the MARXREAD.ME file.'
  273. Writeln
  274. WriteCenter( ' * Press any Key to Continue * ' )
  275. Cursor Off
  276. LastKey = ReadKey
  277. EraseTopWindow
  278.  
  279. ExitMenu
  280.  
  281. ;--- Menu Exits Here
  282.  
  283. ;===================== Procedures ========================
  284.  
  285. ;--- Check the environment size
  286.  
  287. Procedure CheckEnvSize
  288. var NeededSpace ShellCommand OldComspec
  289.    if EnvFree < 150
  290.       OldComspec = ReadEnv('COMSPEC')
  291.       ConfigSysPath = ExistOnPath( 'CONFIG.SYS' )
  292.       NeededSpace = (EnvSize + 160) / 16 * 16
  293.       if DosVerNumber < 320
  294.          ShellCommand = Str(NeededSpace / 16)
  295.       else
  296.          ShellCommand = Str(NeededSpace)
  297.       endif
  298.       if ConfigSysPath = ''
  299.          BoxBorderColor LCyan Blue
  300.          BoxInsideColor White Blue
  301.          DrawBox 15 8 51 13
  302.          WriteCenter '* Warning! *'
  303.          Writeln char(7)
  304.          Writeln '  You have a total of ' EnvSize ' bytes of environment'
  305.          Writeln '  space with only ' EnvFree ' bytes free. MarxMenu'
  306.          Writeln '  requires about 150 bytes of free environment'
  307.          Writeln '  space. You should modify you CONFIG.SYS file'
  308.          Writeln '  as follows:'
  309.          Writeln
  310.          WriteCenter 'SHELL=COMMAND.COM /P /E:' ShellCommand
  311.          Writeln
  312.          Writeln
  313.          WriteCenter(' * Press any Key to Continue * ')
  314.          Cursor Off
  315.          LastKey = ReadKey
  316.          EraseTopWindow
  317.       else
  318.          ReadTextFile(ConfigSysPath,ConfigSysLines)
  319.          Loop(NumberOfElements(ConfigSysLines))
  320.            WorkStr = UpperCase(ConfigSysLines[LoopIndex])
  321.            If (NextWord( WorkStr) = 'SHELL')
  322.              Delete( ConfigSysLines,LoopIndex,1)
  323.            EndIf
  324.          EndLoop
  325.          ShellCommand = 'SHELL=' + OldComspec + ' /P /E:' + ShellCommand
  326.          ConfigSysLines[NumberOfElements(ConfigSysLines) + 1] = ShellCommand
  327.          WriteTextFile(ConfigSysPath,ConfigSysLines)
  328.       endIf
  329.    endIf
  330. EndProc
  331.  
  332.  
  333. Procedure AddLine (L)
  334.    FileLinePtr = FileLinePtr + 1
  335.    FileLine[FileLinePtr] = L
  336. EndProc
  337.  
  338.  
  339. Procedure ClearLineBuffer
  340.    Dispose(FileLine)
  341.    FileLinePtr = 0
  342. EndProc
  343.  
  344.  
  345. Procedure InitialDisplay
  346.    if ColorScreen
  347.       TextColor Cyan Blue
  348.       ClearScreen 176
  349.       GotoXY 1 25
  350.       TextColor Yellow Mag
  351.       ClearLine
  352.       WriteCenter 'MarxMenu Version ' MarxVersion ' * Copyright 1989-92 by Marc Perkel'
  353.       BoxBorderColor White Brown
  354.       BoxInsideColor Yellow Brown
  355.       BoxHeaderColor Yellow Mag
  356.       ClockColor Yellow Brown
  357.       TextColor Yellow Brown
  358.    else
  359.       ClearScreen 176
  360.       TextColor Black Grey
  361.       GotoXY 1 25
  362.       ClearLine
  363.       WriteCenter 'MarxMenu Version ' MarxVersion ' * Copyright 1989-92 by Marc Perkel'
  364.       BoxBorderColor Black Grey
  365.       BoxInsideColor Black Grey
  366.       BoxHeaderColor Black Grey
  367.       ClockColor Black Grey
  368.    endif
  369.  
  370.    SingleLineBox
  371.    Explode Off
  372.    DrawBox 1 1 80 3
  373.    GotoXY (54,1)
  374.    Write "MarxMenu Installation"
  375.    ClockPos 3 2
  376.  
  377.    BlankTime = 0
  378.    ScrollMove Off
  379.  
  380.    Explode On
  381.    Shadow Off
  382.    BlockBox
  383.    InverseColor Yellow Red
  384.  
  385.    BoxBorderColor Yellow Mag
  386.    BoxInsideColor Mag Mag
  387.    DrawBox 10 6 61 17
  388.    BoxBorderColor LGreen Blue
  389.    BoxInsideColor Yellow Blue
  390.    Shadow On
  391.  
  392.    DrawBox 35 13 11 3
  393.    WriteCenter 'The'
  394.    Loop 5
  395.       MoveWindow -4 -1
  396.       Wait 3
  397.    EndLoop
  398.  
  399.    DrawBox 35 13 11 3
  400.    WriteCenter 'Marx'
  401.    Loop 5
  402.       MoveWindow 4 -1
  403.       Wait 3
  404.    EndLoop
  405.  
  406.    DrawBox 35 13 11 3
  407.    WriteCenter 'Menu'
  408.    Loop 5
  409.       MoveWindow -4 1
  410.       Wait 3
  411.    EndLoop
  412.  
  413.    DrawBox 35 13 11 3
  414.    WriteCenter 'System'
  415.    Loop 5
  416.       MoveWindow 4 1
  417.       Wait 3
  418.    EndLoop
  419.  
  420.    Wait 20
  421.    DrawBox 25 13 31 3
  422.    WriteCenter 'Installation Menu'
  423.    Wait 250
  424.    RollWindow 4
  425.    EraseTopWindow
  426.    Wait 20
  427.    RollWindow 3
  428.    EraseTopWindow
  429.    Wait 20
  430.    RollWindow 2
  431.    EraseTopWindow
  432.    Wait 20
  433.    RollWindow 1
  434.    EraseTopWindow
  435.    Wait 20
  436.    EraseTopWindow
  437. EndProc
  438.